import {
    createRouter,
    createWebHashHistory
} from 'vue-router'

import UseSwitch1 from "../components/use_common/UseSwitch1.vue"
import UseSwitch2 from "../components/use_common/UseSwitch2.vue"
import UseDropDown from "../components/use_common/UseDropDown.vue"
import UseWindow from "../components/use_common/UseWindow.vue"
import UseTip from "../components/use_common/UseTip.vue"
import UseButton from "../components/use_common/UseButton.vue"
import Component from "../components/Index.vue"
import Introduce from "../Introduce/Index.vue"
import UseSliderInput from "../components/use_common/UseSliderInput.vue"
import UseSlider from "../components/use_common/UseSlider.vue"
import UseProgressBar from "../components/use_common/UseProgressBar.vue"
import UseTree from "../components/use_common/UseTree.vue"


const router = createRouter({
    history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
    linkExactActiveClass: "active",
    routes: [

        { //初始化根目录路由
            path: '/',
            name: 'init',
            redirect: '/component', 
        },
        {
            path: '/component',
            name: 'component',
            redirect: '/component/switch1', 
            components:{
                level1: Component
            },
            children:[
                {
                    path: "switch1",
                    name: "switch1",
                    components: {
                        level2: UseSwitch1,
                    },
                },
                {
                    path: "switch2",
                    name: "switch2",
                    components: {
                        level2: UseSwitch2,
                    },
                },
                {
                    path: "dropdown",
                    name: "dropdown",
                    components: {
                        level2:UseDropDown
                    },
                },
                
                {
                    path: "window",
                    name: "window",
                    components: {
                        level2:UseWindow
                    },
                },

                {
                    path: "tip",
                    name: "tip",
                    components: {
                        level2:UseTip
                    },
                },

                {
                    path: "button",
                    name: "button",
                    components: {
                        level2:UseButton
                    },
                },
                {
                    path: "sliderinput",
                    name: "sliderinput",
                    components: {
                        level2:UseSliderInput
                    },
                },
                {
                    path: "slider",
                    name: "slider",
                    components: {
                        level2:UseSlider
                    },
                },
                {
                    path: "progressbar",
                    name: "progressbar",
                    components: {
                        level2:UseProgressBar
                    },
                },
                {
                    path: "tree",
                    name: "tree",
                    components: {
                        level2:UseTree
                    },
                },
                
                
                
            ]
        },
        {
            path: '/introduce',
            name: 'introduce',
            // redirect: '/component', //子路由默认打开哪个 
            components:{
                level1: Introduce
            }
        },
        
       
    ]
})

export default router